<template>
	<view class="myOrderBox">
		<view class="" v-for="(i,n) in list" :key="n">
		
			<view class="artItem bgWhite plr18 ptb15      ">
				<view class="justify-between align-center">
					<text class="name">{{i.type_name}}</text>
					
				</view>

				<view class="justify-between mt12  align-center" @click="toMain(i)">
					<text style="color: #49806F;">查看详情</text>
					<uv-icon name="arrow-right" size="12"></uv-icon>
				</view>
			</view>
		</view>

		<view class="" v-if="list.length==0">
			<uv-empty mode="data" icon="https://cdn.uviewui.com/uview/empty/data.png"></uv-empty>
		</view>

	</view>
</template>

<script>
	export default {
		data() {
			return {
				page: 1,
				list: [],
				total: 0

			};
		},
		onLoad() {

			this.list = []
			this.getlist()
		},

		methods: {
			formateTime(data) {
				return this.$utils.formatDateTime(data)
			},
			getlist() {
				uni.showLoading({
					title: '加载中'
				})
				this.$api.hetongList().then(res => {
					console.log(res)
					if (res.code == 1) {
						this.total = res.data.total
						this.list = [...this.list, ...res.data.rows]
					}

				})
			},
			toMain(i){
				if(i.type==3){

					
					uni.previewImage({
						urls:i.dianzihetong_img
					})

				}else{
					uni.downloadFile({
						url: i.dianzihetong,
						success: function(res) {
							var filePath = res.tempFilePath;
							uni.openDocument({
								filePath: filePath,
								showMenu: true,
								success: function(res) {
									uni.hideLoading()
									console.log('Document opened successfully');
								},
								fail: function(err) {
									console.log('Failed to open document', err);
								}
							});
					
						}
					});
				}
				
			}
			},
			}
			
</script>

<style lang="scss" scoped>
	.myOrderBox {

		position: relative;


		.orderTitle {
			width: 750rpx;
			height: 98rpx;
			// background-color: #FFFFFF;
			display: flex;
			font-size: 26rpx;
			color: #666666;
			border-bottom: 2rpx solid rgba(151, 151, 151, 0.062);

			.titleItem {
				height: 98rpx;
				line-height: 98rpx;
				text-align: center;
				flex-basis: 0rpx;
				flex-grow: 1;
				font-weight: 600;
			}

			.active {
				height: 98rpx;
				line-height: 98rpx;
				text-align: center;
				flex-basis: 0rpx;
				flex-grow: 1;
				color: #000000;
				position: relative;
				font-weight: 600;
			}

			.active::after {
				position: absolute;
				content: "";
				width: 74rpx;
				height: 4rpx;
				bottom: 0rpx;
				left: 50%;
				transform: translateX(-50%);
				background: #2CC6A1;
			}
		}

	}

	.submitPz {
		width: 165rpx;
		height: 54rpx;
		background: #434343;
		border-radius: 6rpx;
		font-size: 24rpx;
		color: #FFFFFF;
		text-align: center;
		line-height: 54rpx;
	}

	.artItem {

		font-size: 28rpx;
		color: #999999;
		width: 706rpx;
		// height: 250rpx;
		margin: 20rpx auto 0;
		border-radius: 15rpx;
		line-height: 1;

		.name {
			font-size: 30rpx;
			color: #333;
			font-weight: bold;
		}

		.number {
			font-size: 32rpx;
			color: #49806F;
			font-weight: bold;
		}


	}

	.desc {
		padding: 30rpx 0;
		border-bottom: 1rpx solid #F2F2F2;
	}

	.mt16 {
		margin-top: 32rpx;
	}

	.time {
		font-size: 24rpx;
		color: #8F8F8F;
		text-align: center;
		margin: 33rpx 0;
	}

	.circle {
		width: 13rpx;
		height: 13rpx;
		background: #FF4040;
		border-radius: 50%;
	}
</style>